package data;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.regex.Pattern;

import org.apache.poi.hssf.usermodel.HSSFPatternFormatting;
import org.apache.poi.hssf.util.HSSFColor;

/**
 * Holds generic data
 * @author Jonathan Chuang
 *
 */
public class Reference {
	public static ArrayList<String> countryList;
	public static ArrayList<String> equalityList;
	public static ArrayList<String> connectorList;
	public static ArrayList<Integer> groupNoList;
	public static ArrayList<String> fieldTypeList;
	public static String VERSION = "v1.0";
	public static int reportNo = 1;
	public static String reportGenerator = "Report Generator";
	private static boolean initialized = false;
	/*
	 * Cell shading properties
	 */
	public static short dateCellFilledColor = HSSFColor.YELLOW.index;
	public static short dateCellFilledPattern = HSSFPatternFormatting.SOLID_FOREGROUND;
	public static short cellFilledColor = HSSFColor.YELLOW.index;
	public static short cellFilledPattern = HSSFPatternFormatting.SOLID_FOREGROUND;
	
	public static Pattern ALPHANUMERIC = Pattern.compile("[A-Za-z0-9]+");
	public static String EMAIL_REGEX = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
	public static String XLS_REGEX = "[a-zA-Z\\d\\.\\-*]+\\.{1}x{1}l{1}s{1}";
	
	public static SimpleDateFormat sdf1 = new SimpleDateFormat("MM/dd/yyyy");
	public static SimpleDateFormat sdf2 = new SimpleDateFormat("dd/MM/yyyy");
	public static SimpleDateFormat sdf3 = new SimpleDateFormat("MM/dd/yy");
	
	public static void initialize(){
		if(!initialized){
			initialized = true;
			countryList = new ArrayList<String>();
			equalityList = new ArrayList<String>();
			connectorList = new ArrayList<String>();
			groupNoList = new ArrayList<Integer>();
			fieldTypeList = new ArrayList<String>();
			//populate countryList
			
			//populate equalityList
			equalityList.add("AFTER");
			equalityList.add("BEFORE");
			
			//populate connectorList
			connectorList.add("");
			connectorList.add("AND");
			connectorList.add("AND NOT");
			connectorList.add("OR");
			connectorList.add("OR NOT");
			
			//populate groupNoList
			groupNoList.add(1);
			groupNoList.add(2);
			groupNoList.add(3);
			groupNoList.add(4);
			
			//populate fieldTypeList
			fieldTypeList.add("STRING");
			fieldTypeList.add("NUMBER");
			fieldTypeList.add("DATE");
			fieldTypeList.add("CNEE");
			fieldTypeList.add("ORIGIN");
		}
	}
	
}
